package com.jia.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import com.jia.R;

/**
 * Description:
 * <br/>site: <a href="http://www.crazyit.org">crazyit.org</a>
 * <br/>Copyright (C), 2001-2014, Yeeku.H.Lee
 * <br/>This program is protected by copyright laws.
 * <br/>Program Name:
 * <br/>Date:
 *
 * @author Yeeku.H.Lee kongyeeku@163.com
 * @version 1.0
 */
public class AnimationDrawable extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.animation_drawable);

        final ImageView image = (ImageView) findViewById(R.id.image);

        final Animation anim = AnimationUtils.loadAnimation(this,
                R.anim.my_anim);

        // 设置动画结束后保持结束状态
        anim.setFillAfter(true);

        Button bn = (Button) findViewById(R.id.bn);

        bn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                image.startAnimation(anim);
            }
        });
    }
}